﻿#region Includes

using System;
using System.IO;
using System.Windows.Forms;

#endregion

namespace ArtheaEditor
{
    public partial class ImportDialog : Form
    {
        public ImportDialog()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                var fi = new FileInfo(textBox1.Text);

                var importer = new RomImporter();
                importer.Process(fi);
            }
            catch (ArgumentException)
            {
                MessageBox.Show("Please specify a file first!");
            }
            catch (RomImportException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}